﻿<!DOCTYPE html>
<html lang="en">
<#include "../common/common-head.html"/>
<body class="gray-bg top-navigation">
<div id="wrapper">
    <div id="page-wrapper" class="gray-bg">
    <#include "../common/common-menu.html">
        <div class="wrapper wrapper-content">
            <div class="row white-bg" style="padding: 18px 0">
                <div class="col-xs-12">
                    <form class="form-horizontal m-t" action="${basePath}/orders/add" method="post"
                          onsubmit="memberSel()">
                        <div class="col-xs-6">
                        <@formAdd labels=["产品名称","客服"] names=["name","kefu"]></@formAdd>
                        <@formAddDate label="登记日期" name="enrolldate"></@formAddDate>
                        <@formAddDate label="出发日期" name="godate"></@formAddDate>
                        <@formAddNum label="天数" name="day"></@formAddNum>
                        <@formAddNum label="价格" name="price"></@formAddNum>
                            <@formAddSel label="保险" name="safe" valueMap={"未买":"未买","已买":"已买"}></@formAddSel>
                            <div class="form-group">
                                <div class="col-xs-8 col-xs-offset-3">
                                    <button class="btn btn-primary" type="submit">提交</button>
                                </div>
                            </div>

                        </div>
                        <div class="col-xs-6">
                            <div class="input-group">
                                <span class="input-group-addon">出行会员</span>
                                <input type="text" name="memberid" class="form-control" id="test_data" >
                                <div class="input-group-btn">
                                    <ul class="dropdown-menu dropdown-menu-right" role="menu"></ul>
                                </div>
                            </div>
                            <br/>
                            <div class="input-group">
                                <span class="input-group-addon">出行备注</span>
                                <textarea name="remark" class="form-control"></textarea>
                            </div>
                            <br/>
                        <@formAddNo labels=["用户名(非会员)","身份证号(非会员)","联系方式(非会员)"] names=["name2","card2","phone2"]></@formAddNo>
                        </div>

                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    var testdataBsSuggest = $("#test_data").bsSuggest({
        idField: "id",                    //每组数据的哪个字段作为 data-id，优先级高于 indexId 设置（推荐）
        keyField: "name",                   //每组数据的哪个字段作为输入框内容，优先级高于 indexKey 设置（推荐）
        allowNoKeyword: false, //是否允许无关键字时请求数据
        multiWord: false, //以分隔符号分割的多关键字支持
        separator: ",", //多关键字支持时的分隔符，默认为空格
        getDataMethod: "url", //获取数据的方式，总是从 URL 获取
        url: "/orders/searchMember?key=",
        processData: function (json) {// url 获取数据时，对数据的处理，作为 getData 的回调函数
            var i, len, data = {value: []};
            if (!json || json.length == 0) {
                return false;
            }
            len = json.length;
            for (i = 0; i < len; i++) {
                data.value.push({
                	"id": json[i].id,
                	"no": json[i].no,
                    "name": json[i].name,
                    "phone": json[i].phone,
                    "mobile": json[i].mobile,
                    "card": json[i].card
                });
            }
            console.log(data);
            return data;
        }
    });
    $('.date-picker').datetimepicker({autoclose: true, language: 'zh-CN', minView: 2});

    function memberSel() {
        var id = $("#test_data").data("id");
        if (id.length == 0) {
            alert("请选择出行的会员");
            return false;
        }
        $("#test_data").val(id);
        return true;
    }
</script>
</body>
</html>

